/**
 * @file epd_ssd167x.h
 * @brief Wrapper for SSD167x-style 7.5" B/C tri-color driver (epd7in5bc).
 */
#ifndef EPD_SSD167X_H
#define EPD_SSD167X_H

#include <stdint.h>
#include <stdbool.h>
#include "epd_hal.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    uint16_t width;
    uint16_t height;
    double refresh_rate_hz; /* desired rate (1..30Hz, step 0.1) – advisory only */
} epd_ssd167x_t;

/**
 * @brief Initialize SSD167x panel via existing epd7in5bc driver.
 * @param dev Device instance.
 * @return epd_err_t
 */
epd_err_t epd_ssd167x_init(epd_ssd167x_t *dev);

/**
 * @brief Clear display (white).
 * @param dev Device instance.
 * @return epd_err_t
 */
epd_err_t epd_ssd167x_clear(epd_ssd167x_t *dev);

/**
 * @brief Display given BW and RY 1bpp planes.
 * @param dev Device instance.
 * @param bw Plane for black pixels (1=black, 0=white), size width*height/8.
 * @param ry Plane for red/yellow pixels (1=accent, 0=no accent), size width*height/8.
 * @return epd_err_t
 */
epd_err_t epd_ssd167x_display(epd_ssd167x_t *dev, const uint8_t *bw, const uint8_t *ry);

/**
 * @brief Enter sleep (deep=true => deep sleep).
 * @param dev Device instance.
 * @param deep Deep sleep flag.
 * @return epd_err_t
 */
epd_err_t epd_ssd167x_sleep(epd_ssd167x_t *dev, bool deep);

/**
 * @brief Set desired refresh rate advisory.
 * @param dev Device instance.
 * @param hz Target Hz (1..30, step 0.1).
 * @return epd_err_t
 */
epd_err_t epd_ssd167x_set_refresh_rate(epd_ssd167x_t *dev, double hz);

#ifdef __cplusplus
}
#endif

#endif /* EPD_SSD167X_H */